package part1;

import java.io.FileNotFoundException;
import java.io.PrintWriter;

/**
 * Main1Write
 *  - Writing to a text file
 * @author tony
 *
 */
public class Main1Write {

	public static void main(String[] args) {
		final String OUTPUTFILENAME = "output.txt";
		Data d = new Data( 10, "Hello" );
		System.out.println( "In this program we will write the data members of an object to the file " + OUTPUTFILENAME );
		
		try {
			PrintWriter pw = new PrintWriter( OUTPUTFILENAME );
			pw.println( d.getX() );
			pw.println( d.getY() );
			pw.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		System.out.println("OK, done - refresh your project to see the file.");
	}
}
